using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using System.Collections.Generic;
using MyListAdapter.Models;

namespace MyListAdapter
{
	[Activity (Label = "MyListAdapter", MainLauncher = true)]
	public class MainActivity : ListActivity
	{
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // ???????
            InitListData();
        }

        /// <summary>
        /// ???????
        /// </summary>
        public void InitListData()
        {
    
            var _list = new List<Employee>()
            {
                new Employee() { Name = "Caroline",Number = "2345"}	,
                new Employee() { Name = "John",Number = "2345"}	,
                new Employee() { Name = "Animax",Number = "2345"}	,
                new Employee() { Name = "Jim",Number = "2345"}	,
                new Employee() { Name = "Steven",Number = "2345"}	,
                new Employee() { Name = "Jim",Number = "2345"}	,
                new Employee() { Name = "Alexa",Number = "2345"}	,
                new Employee() { Name = "Collin",Number = "2345"}	
            };

            _list[0].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[1].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[1].AddLog(CheckType.OUT, DateTime.Now);
            _list[2].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[2].AddLog(CheckType.OUT, DateTime.Now);
            _list[3].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[4].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[4].AddLog(CheckType.OUT, DateTime.Now);
            _list[5].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[6].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));
            _list[7].AddLog(CheckType.IN, DateTime.Now.AddHours(-10));

            /*
            foreach (var item in _list)
            {
                item.AddLog(CheckOutType.IN, DateTime.Now.AddHours(-10));
                item.AddLog(CheckOutType.OUT, DateTime.Now.AddHours(-5));
                item.AddLog(CheckOutType.IN, DateTime.Now);
            }
             */

            this.ListAdapter = new EmployeesAdapter(this, _list);
        }
	}
}